fix: require JSON media type for orchestrator health - #697
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthrough
Changes오케스트레이터 healthz Content-Type 검증
Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
seonghobae
left a comment
There was a problem hiding this comment.
Exact-head review at 1e0ac2eac6d3172468c842cae957079305c33a1d: the media-type admission is confined to Noema's contextual-orchestrator health consumer; prior byte/deadline/UTF-8/duplicate-key/reader-cleanup invariants remain intact. Hosted RED reproduced the original acceptance defect; subsequent fixture and coverage findings were repaired without weakening the production guard. All four exact-head required lanes are terminal SUCCESS and there are no inline review threads. This is a COMMENT-only review, not self-approval.
…alth-media-authority-20260913 docs: converge protected #697 health media authority
Finding
Noema's contextual-orchestrator
/healthzverifier bounds response bytes, normalizes locked reader acquisition, uses fatal UTF-8 and duplicate-key JSON admission, and requires the exact{ status: "ok", service: "contextual-orchestrator" }identity. It did not validate the successful response media type before accepting those bytes. A reverse proxy, error page, or other non-JSON representation containing the same JSON-shaped text could therefore satisfy identity admission despite not being anapplication/jsonhealth document.This lane changes only Noema-owned consumption/admission of contextual-orchestrator health evidence. It does not move service/provider/model routing, credentials, outbound authority, quarantine/security authority, release/deployment authority, or foreign domain truth into Noema.
Test-first RED
Test-only exact
27fefd8c23846841660199dcb86775c164715966added hostile coverage requiring a valid identity document served astext/plain; charset=utf-8to fail closed with the stable diagnosticcontextual-orchestrator health response content-type is not application/json. It also pins acceptance ofapplication/json; charset=utf-8so ordinary media-type parameters remain valid.Hosted application CI
34727039322reproduced the defect after typecheck: release tests failed because the non-JSON representation was accepted as a valid contextual-orchestrator identity.Causal repair and verification findings
The minimal source repair validates the successful response
Content-Typemedia type before body consumption and preserves the 65,536-byte ceiling, optional caller-supplied deadline with no invented default timeout, fixed retained buffer, best-effort cancellation, reader-lock lifecycle, fatal UTF-8, duplicate-key/JSON admission, and exact orchestrator identity.Exact
1f5b17eac160beb47735a91938f4fc50daba1491exposed a separate test-fixture defect in hosted CI34727236581: 20 existing tests used otherwise-valid health response doubles without a JSON media type, so the strengthened admission correctly failed before those tests reached their intended byte-bound, timeout, identity, or cleanup assertions. The repair updates only those fixtures to satisfy the now-explicit media contract; the production guard is not weakened.Exact
81c96108c5401b80afc441135a5a40e1545e2df3then passed all 4,768 tests, but application CI34727550279correctly rejected the head because the new async cancellation rejection callback atscripts/lib/orchestrator-gateway.mjs:344was not executed and owned statement/function coverage fell below 100%. The final test repair makesresponse.body.cancel()reject asynchronously under a non-JSON response and proves the already-decided media-type failure remains authoritative. It also pins the missing-Content-Type fail-closed path.Exact-head GREEN
Final exact is
1e0ac2eac6d3172468c842cae957079305c33a1d.34727701836: SUCCESS34727701829: SUCCESS34727701821: SUCCESS34727701818: SUCCESSInline review threads are empty. No gate weakening, force-push, destructive rebase, self-approval, provider fallback, or foreign authority duplication.
Summary by CodeRabbit
버그 수정
application/json형식인지 검증합니다.application/json에 추가 매개변수가 포함된 형식은 계속 허용됩니다.테스트